/****************************************************************************
 * Elisa 1.0                                                                *
 *--------------------------------------------------------------------------*
 * Author: Laurent Granvilliers, Vincent Sorin                              *
 * Copyright (c) 2004 Laboratoire d'Informatique de Nantes Atlantique       *
 *--------------------------------------------------------------------------*
 * Elisa is distributed WITHOUT ANY WARRANTY. Read the associated           *
 * COPYRIGHT file for more details.                                         *
 *--------------------------------------------------------------------------*
 * elisa_initialization.cpp                                                 *
 ****************************************************************************/

#include "elisa_variable.h"
#include "elisa_real_var.h"
#include "elisa_reduction.h"
#include "elisa_interval_strategy.h"
#include "elisa_box_reduction.h"
#include "gaol/gaol"

#include "elisa_initialization.h"


NAMESPACE_ELISA

void init()
{
	gaol::init();

	// initialization of the comparator
	VariableImplCmp *v = new RealVarImplementationComparator();
	VariableImplCmpChooser::insert("RealVarImplementation", "RealVarImplementation", v);
	v = new RealVarImplementationComparator();
	VariableImplCmpChooser::insert("IntVarImplementation", "IntVarImplementation", v);
}

void dismiss()
{
	ReductionFactoryChooser::clear();
	VariableImplCmpChooser::clear();

	gaol::cleanup();
}

void useBC3()
{
	ReductionFactory *bcc = new BC3ReviseFactory(new NaturalIntervalFormFactory());
	ReductionFactoryChooser::insert("RealConstraint", bcc);
	ReductionFactory *bc3 = new FPFactory();
	ReductionFactoryChooser::insert("AndModel", bc3);
}

void useBC4()
{
	ReductionFactory *bcc = new BC4Factory(new NaturalIntervalFormFactory());
	ReductionFactoryChooser::insert("RealConstraint", bcc);
	ReductionFactory *bc4 = new FPFactory();
	ReductionFactoryChooser::insert("AndModel", bc4);
}

void useHC4()
{
	ReductionFactory *hcc = new HC4ReviseFactory(new NaturalIntervalFormFactory());
	ReductionFactoryChooser::insert("RealConstraint", hcc);
	ReductionFactory *hc4 = new FPFactory();
	ReductionFactoryChooser::insert("AndModel", hc4);
}

void useBC5()
{
	ReductionFactory *bcc = new BC4Factory(new NaturalIntervalFormFactory());
	ReductionFactoryChooser::insert("RealConstraint", bcc);
	ReductionFactory *bc5 = new FPNewtonFactory();
	ReductionFactoryChooser::insert("AndModel", bc5);
}

void useBCNewton()
{
	ReductionFactory *bcc = new BC3ReviseFactory(new NaturalIntervalFormFactory());
	ReductionFactoryChooser::insert("RealConstraint", bcc);
	ReductionFactory *bc5 = new FPNewtonFactory();
	ReductionFactoryChooser::insert("AndModel", bc5);
}

END_NAMESPACE_ELISA
